from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By

driver=webdriver.Firefox()
driver.maximize_window()
driver.get('file:///C:/Users/HP/Desktop/%E5%BC%B9%E7%AA%97/prompt.html')
sleep(5)

driver.find_element(By.ID,'button').click()
sleep(5)

alert=driver.switch_to.alert
alert.send_keys('天天开心')
sleep(5)

alert.accept()